package LeetCode.leetcode11;

class Solution {
    public int maxArea(int[] height) {
        int i = 0, j = height.length - 1;
        int maxArea = 0;
        while (i < j) {
            int curHeight = Math.min(height[i], height[j]);
            maxArea = Math.max(maxArea, curHeight * (j - i));
            if (height[i] < height[j]) {
                i++;
            }else {
                j--;
            }
        }
        return maxArea;
    }
}